import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/common/xindong_all.dart';
import 'package:xindong/utils/xindong_text_util.dart';

class XinDongEditTextView extends StatelessWidget {
  final String title;
  final String? content;
  final String hint;
  final Function() onTap;

  const XinDongEditTextView(
      {Key? key, required this.title, required this.content, required this.hint, required this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    const TextStyle textStyle = TextStyle(color: DZColors.titleColor, fontSize: 16);
    return GestureDetector(
      onTap: onTap,
      child: Container(
        height: kCellHeight,
        color: DZColors.cellColor,
        padding: const EdgeInsets.only(left: 16, right: 16),
        margin: const EdgeInsets.only(bottom: 1),
        child: Row(
          children: [
            Text(title, style: textStyle),
            Expanded(
              child: Text(
                TextUtil.isEmpty(content) ? hint : content!,
                style: TextStyle(
                    color: TextUtil.isEmpty(content) ? DZColors.placeholderColor : DZColors.contentColor, fontSize: 16),
                textAlign: TextAlign.right,
              ),
            ),
            const SizedBox(width: 4),
            XinDongAll.instance.defaultIconNext,
          ],
        ),
      ),
    );
  }
}
